import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { RechargeCodeVO, RechargeCodeForm, RechargeCodeQuery } from '@/api/system/rechargeCode/types';

/**
 * 查询充值码明细列表
 * @param query
 * @returns {*}
 */

export const listRechargeCode = (query?: RechargeCodeQuery): AxiosPromise<RechargeCodeVO[]> => {
  return request({
    url: '/system/rechargeCode/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询充值码明细详细
 * @param id
 */
export const getRechargeCode = (id: string | number): AxiosPromise<RechargeCodeVO> => {
  return request({
    url: '/system/rechargeCode/' + id,
    method: 'get'
  });
};

/**
 * 新增充值码明细
 * @param data
 */
export const addRechargeCode = (data: RechargeCodeForm) => {
  return request({
    url: '/system/rechargeCode',
    method: 'post',
    data: data
  });
};

/**
 * 修改充值码明细
 * @param data
 */
export const updateRechargeCode = (data: RechargeCodeForm) => {
  return request({
    url: '/system/rechargeCode',
    method: 'put',
    data: data
  });
};

/**
 * 删除充值码明细
 * @param id
 */
export const delRechargeCode = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/rechargeCode/' + id,
    method: 'delete'
  });
};
